UMGCC FCSS

Author

Instrument QC

library(dplyr)
library(lubridate)
library(stringr)
library(plotly)

Computer <- getwd()
MainFolder <- file.path(Computer, "data")
TheList <- c("3L", "4L", "5L", "CS")
UpdateTheDataset <- source("QC_UpdateData.R")
CurrentData <- function(x, MainFolder, type){
  ArchiveLocation <- file.path(MainFolder, x, "Archive")
  
  if (type == "MFI"){
  BeadData <- list.files(ArchiveLocation, pattern="Bead",
                         full.names=TRUE)
  Data <- read.csv(BeadData, check.names=FALSE)
  Data$DateTime <- lubridate::ymd_hms(Data$DateTime)
  Data$DATE <- lubridate::ymd(Data$DATE)
  Data$TIME <- lubridate::hms(Data$TIME)
  }
  
  if (type == "Gain"){
  ArchiveData <- list.files(ArchiveLocation, pattern="Archived",
                         full.names=TRUE)
  Data <- read.csv(ArchiveData, check.names=FALSE)
  #lubridate::ymd_hms(Data$DateTime)
  
  if (any(str_detect(Data$DateTime, ":.*:"))){
   Data$DateTime <- lubridate::ymd_hms(Data$DateTime) 
  } else {Data$DateTime <- lubridate::mdy_hm(Data$DateTime)}
  }
  
  Data <- Data %>% arrange(desc(DateTime))
  return(Data)
}

ColorPriority <- function(colors){
  Ordered <- colors[order(grepl("^Ultra", colors) * -1,
                          grepl("^UV", colors) * -1,
                          grepl("^Violet", colors) * -1,
                          grepl("^Blue", colors) * -1,
                          grepl("^Yellow", colors) * -1,
                          grepl("^Red", colors) * -1)]
  return(Ordered)
}

ScalePriority <- function(colors){
  Ordered <- colors[order(grepl("^FSC", colors) * -1,
                          grepl("^SSC", colors) * -1,
                          grepl("-A", colors) * -1,
                          grepl("-H", colors) * -1,
                          grepl("-W", colors) * -1)]
  return(Ordered)
}
MFI_3L <- CurrentData(x="3L", MainFolder=MainFolder, type = "MFI")
Gain_3L <- CurrentData(x="3L", MainFolder=MainFolder, type = "Gain")

MFI_4L <- CurrentData(x="4L", MainFolder=MainFolder, type = "MFI")
Gain_4L <- CurrentData(x="4L", MainFolder=MainFolder, type = "Gain")

MFI_5L <- CurrentData(x="5L", MainFolder=MainFolder, type = "MFI")
Gain_5L <- CurrentData(x="5L", MainFolder=MainFolder, type = "Gain")

MFI_CS <- CurrentData(x="CS", MainFolder=MainFolder, type = "MFI")
Gain_CS <- CurrentData(x="CS", MainFolder=MainFolder, type = "Gain")
WindowOfInterest <- Sys.time() - months(6)

MFI_3L <- MFI_3L %>% filter(DateTime >= WindowOfInterest)
Gain_3L <- Gain_3L %>% filter(DateTime >= WindowOfInterest)

MFI_4L <- MFI_4L %>% filter(DateTime >= WindowOfInterest)
Gain_4L <- Gain_4L %>% filter(DateTime >= WindowOfInterest)

MFI_5L <- MFI_5L %>% filter(DateTime >= WindowOfInterest)
Gain_5L <- Gain_5L %>% filter(DateTime >= WindowOfInterest)

MFI_CS <- MFI_CS %>% filter(DateTime >= WindowOfInterest)
Gain_CS <- Gain_CS %>% filter(DateTime >= WindowOfInterest)

Home

An initial example

3L

x <- MFI_3L
x <- x %>% dplyr::filter(Timepoint %in% c("Before", "After"))
TheColumns <- x %>% select(where(~is.numeric(.)||is.integer(.))) %>% colnames()
TheColumns <- setdiff(TheColumns, "TIME")
TheIntermediate <- TheColumns[!str_detect(TheColumns, "Gain")]
TheColumnNames <- TheIntermediate[str_detect(TheIntermediate, "-A")]
  
#UltraVioletGains <- TheColumnNames[str_detect(TheColumnNames, "^UV")]
VioletGains <- TheColumnNames[str_detect(TheColumnNames, "^V")]
BlueGains <- TheColumnNames[str_detect(TheColumnNames, "^B")]
#YellowGreenGains <- TheColumnNames[str_detect(TheColumnNames, "^YG")]
RedGains <- TheColumnNames[str_detect(TheColumnNames, "^R")]

ScatterGains <- TheIntermediate[str_detect(TheIntermediate, "SC-")]
ScatterGains <- ScalePriority(ScatterGains)
LaserGains <- TheIntermediate[str_detect(TheIntermediate, "Laser")]
LaserGains <- ColorPriority(LaserGains)
ScalingGains <- TheIntermediate[str_detect(TheIntermediate, "Scaling")]
ScalingGains <- ColorPriority(ScalingGains)
OtherGains <- c(ScatterGains, LaserGains, ScalingGains)

VioletPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=VioletGains,
                      plotType = "comparison", returntype = "plots",
                      Metadata="Timepoint", strict = TRUE)

BluePlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=BlueGains,
                      plotType = "comparison", returntype = "plots",
                      Metadata="Timepoint", strict = TRUE)

RedPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=RedGains,
                     plotType = "comparison", returntype = "plots",
                     Metadata="Timepoint", strict = TRUE)

OtherPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=OtherGains,
                     plotType = "comparison", returntype = "plots",
                     Metadata="Timepoint", strict = TRUE)
x <- Gain_3L
TheColumns <- x %>% select(where(~is.numeric(.)||is.integer(.))) %>% colnames()
TheColumns <- setdiff(TheColumns, "TIME")
TheColumnNames <- TheColumns[str_detect(TheColumns, "Gain")]

#UltraVioletGains <- TheColumnNames[str_detect(TheColumnNames, "^UV")]
VioletGains <- TheColumnNames[str_detect(TheColumnNames, "^V")]
BlueGains <- TheColumnNames[str_detect(TheColumnNames, "^B")]
#YellowGreenGains <- TheColumnNames[str_detect(TheColumnNames, "^YG")]
RedGains <- TheColumnNames[str_detect(TheColumnNames, "^R")]

ScatterGains <- TheColumnNames[str_detect(TheColumnNames, "SC-")]
ScatterGains <- ScalePriority(ScatterGains)
LaserGains <- TheColumns[str_detect(TheColumns, "Laser")]
LaserGains <- ColorPriority(LaserGains)
ScalingGains <- TheColumns[str_detect(TheColumns, "Scaling")]
ScalingGains <- ColorPriority(ScalingGains)
OtherGains <- c(ScatterGains, LaserGains, ScalingGains)

VioletPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=VioletGains,
                      plotType = "individual", returntype = "plots")

BluePlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=BlueGains,
                      plotType = "individual", returntype = "plots")

RedPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=RedGains,
                     plotType = "individual", returntype = "plots")

OtherPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=OtherGains,
                     plotType = "individual", returntype = "plots")
x <- Gain_3L
TheColumns <- x %>% select(where(~is.numeric(.)||is.integer(.))) %>% colnames()
TheColumns <- setdiff(TheColumns, "TIME")
TheColumnNames <- TheColumns[str_detect(TheColumns, "rCV")]

#UltraVioletGains <- TheColumnNames[str_detect(TheColumnNames, "^UV")]
VioletGains <- TheColumnNames[str_detect(TheColumnNames, "^V")]
BlueGains <- TheColumnNames[str_detect(TheColumnNames, "^B")]
#YellowGreenGains <- TheColumnNames[str_detect(TheColumnNames, "^YG")]
RedGains <- TheColumnNames[str_detect(TheColumnNames, "^R")]

ScatterGains <- TheColumnNames[str_detect(TheColumnNames, "SC-")]
ScatterGains <- ScalePriority(ScatterGains)
LaserGains <- TheColumns[str_detect(TheColumns, "Laser")]
LaserGains <- ColorPriority(LaserGains)
ScalingGains <- TheColumns[str_detect(TheColumns, "Scaling")]
ScalingGains <- ColorPriority(ScalingGains)
OtherGains <- c(ScatterGains)

VioletPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=VioletGains,
                      plotType = "individual", returntype = "plots")

BluePlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=BlueGains,
                      plotType = "individual", returntype = "plots")

RedPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=RedGains,
                     plotType = "individual", returntype = "plots")

OtherPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=OtherGains,
                     plotType = "individual", returntype = "plots")

MFI

ggplotly(VioletPlotsMFI[[1]])
ggplotly(VioletPlotsMFI[[2]])
ggplotly(VioletPlotsMFI[[3]])
ggplotly(VioletPlotsMFI[[4]])
ggplotly(VioletPlotsMFI[[5]])
ggplotly(VioletPlotsMFI[[6]])
ggplotly(VioletPlotsMFI[[7]])
ggplotly(VioletPlotsMFI[[8]])
ggplotly(VioletPlotsMFI[[9]])
ggplotly(VioletPlotsMFI[[10]])
ggplotly(VioletPlotsMFI[[11]])
ggplotly(VioletPlotsMFI[[12]])
ggplotly(VioletPlotsMFI[[13]])
ggplotly(VioletPlotsMFI[[14]])
ggplotly(VioletPlotsMFI[[15]])
ggplotly(VioletPlotsMFI[[16]])
ggplotly(BluePlotsMFI[[1]])
ggplotly(BluePlotsMFI[[2]])
ggplotly(BluePlotsMFI[[3]])
ggplotly(BluePlotsMFI[[4]])
ggplotly(BluePlotsMFI[[5]])
ggplotly(BluePlotsMFI[[6]])
ggplotly(BluePlotsMFI[[7]])
ggplotly(BluePlotsMFI[[8]])
ggplotly(BluePlotsMFI[[9]])
ggplotly(BluePlotsMFI[[10]])
ggplotly(BluePlotsMFI[[11]])
ggplotly(BluePlotsMFI[[12]])
ggplotly(BluePlotsMFI[[13]])
ggplotly(BluePlotsMFI[[14]])
ggplotly(RedPlotsMFI[[1]])
ggplotly(RedPlotsMFI[[2]])
ggplotly(RedPlotsMFI[[3]])
ggplotly(RedPlotsMFI[[4]])
ggplotly(RedPlotsMFI[[5]])
ggplotly(RedPlotsMFI[[6]])
ggplotly(RedPlotsMFI[[7]])
ggplotly(RedPlotsMFI[[8]])
ggplotly(OtherPlotsMFI[[1]])
ggplotly(OtherPlotsMFI[[2]])
ggplotly(OtherPlotsMFI[[3]])
ggplotly(OtherPlotsMFI[[4]])
ggplotly(OtherPlotsMFI[[5]])
ggplotly(OtherPlotsMFI[[6]])
ggplotly(OtherPlotsMFI[[7]])
ggplotly(OtherPlotsMFI[[8]])
ggplotly(OtherPlotsMFI[[9]])
ggplotly(OtherPlotsMFI[[10]])
ggplotly(OtherPlotsMFI[[11]])
ggplotly(OtherPlotsMFI[[12]])

Gain

ggplotly(VioletPlotsGain[[1]])
ggplotly(VioletPlotsGain[[2]])
ggplotly(VioletPlotsGain[[3]])
ggplotly(VioletPlotsGain[[4]])
ggplotly(VioletPlotsGain[[5]])
ggplotly(VioletPlotsGain[[6]])
ggplotly(VioletPlotsGain[[7]])
ggplotly(VioletPlotsGain[[8]])
ggplotly(VioletPlotsGain[[9]])
ggplotly(VioletPlotsGain[[10]])
ggplotly(VioletPlotsGain[[11]])
ggplotly(VioletPlotsGain[[12]])
ggplotly(VioletPlotsGain[[13]])
ggplotly(VioletPlotsGain[[14]])
ggplotly(VioletPlotsGain[[15]])
ggplotly(VioletPlotsGain[[16]])
ggplotly(BluePlotsGain[[1]])
ggplotly(BluePlotsGain[[2]])
ggplotly(BluePlotsGain[[3]])
ggplotly(BluePlotsGain[[4]])
ggplotly(BluePlotsGain[[5]])
ggplotly(BluePlotsGain[[6]])
ggplotly(BluePlotsGain[[7]])
ggplotly(BluePlotsGain[[8]])
ggplotly(BluePlotsGain[[9]])
ggplotly(BluePlotsGain[[10]])
ggplotly(BluePlotsGain[[11]])
ggplotly(BluePlotsGain[[12]])
ggplotly(BluePlotsGain[[13]])
ggplotly(BluePlotsGain[[14]])
ggplotly(RedPlotsGain[[1]])
ggplotly(RedPlotsGain[[2]])
ggplotly(RedPlotsGain[[3]])
ggplotly(RedPlotsGain[[4]])
ggplotly(RedPlotsGain[[5]])
ggplotly(RedPlotsGain[[6]])
ggplotly(RedPlotsGain[[7]])
ggplotly(RedPlotsGain[[8]])
ggplotly(OtherPlotsGain[[1]])
ggplotly(OtherPlotsGain[[2]])
ggplotly(OtherPlotsGain[[3]])
ggplotly(OtherPlotsGain[[4]])
ggplotly(OtherPlotsGain[[5]])
ggplotly(OtherPlotsGain[[6]])
ggplotly(OtherPlotsGain[[7]])
ggplotly(OtherPlotsGain[[8]])

RCV

ggplotly(VioletPlotsRCV[[1]])
ggplotly(VioletPlotsRCV[[2]])
ggplotly(VioletPlotsRCV[[3]])
ggplotly(VioletPlotsRCV[[4]])
ggplotly(VioletPlotsRCV[[5]])
ggplotly(VioletPlotsRCV[[6]])
ggplotly(VioletPlotsRCV[[7]])
ggplotly(VioletPlotsRCV[[8]])
ggplotly(VioletPlotsRCV[[9]])
ggplotly(VioletPlotsRCV[[10]])
ggplotly(VioletPlotsRCV[[11]])
ggplotly(VioletPlotsRCV[[12]])
ggplotly(VioletPlotsRCV[[13]])
ggplotly(VioletPlotsRCV[[14]])
ggplotly(VioletPlotsRCV[[15]])
ggplotly(VioletPlotsRCV[[16]])
ggplotly(BluePlotsRCV[[1]])
ggplotly(BluePlotsRCV[[2]])
ggplotly(BluePlotsRCV[[3]])
ggplotly(BluePlotsRCV[[4]])
ggplotly(BluePlotsRCV[[5]])
ggplotly(BluePlotsRCV[[6]])
ggplotly(BluePlotsRCV[[7]])
ggplotly(BluePlotsRCV[[8]])
ggplotly(BluePlotsRCV[[9]])
ggplotly(BluePlotsRCV[[10]])
ggplotly(BluePlotsRCV[[11]])
ggplotly(BluePlotsRCV[[12]])
ggplotly(BluePlotsRCV[[13]])
ggplotly(BluePlotsRCV[[14]])
ggplotly(RedPlotsRCV[[1]])
ggplotly(RedPlotsRCV[[2]])
ggplotly(RedPlotsRCV[[3]])
ggplotly(RedPlotsRCV[[4]])
ggplotly(RedPlotsRCV[[5]])
ggplotly(RedPlotsRCV[[6]])
ggplotly(RedPlotsRCV[[7]])
ggplotly(RedPlotsRCV[[8]])
ggplotly(OtherPlotsRCV[[1]])
ggplotly(OtherPlotsRCV[[2]])
ggplotly(OtherPlotsRCV[[3]])

4L

x <- MFI_4L
x <- x %>% dplyr::filter(Timepoint %in% c("Before", "After"))
TheColumns <- x %>% select(where(~is.numeric(.)||is.integer(.))) %>% colnames()
TheColumns <- setdiff(TheColumns, "TIME")
TheIntermediate <- TheColumns[!str_detect(TheColumns, "Gain")]
TheColumnNames <- TheIntermediate[str_detect(TheIntermediate, "-A")]
  
UltraVioletGains <- TheColumnNames[str_detect(TheColumnNames, "^UV")]
VioletGains <- TheColumnNames[str_detect(TheColumnNames, "^V")]
BlueGains <- TheColumnNames[str_detect(TheColumnNames, "^B")]
#YellowGreenGains <- TheColumnNames[str_detect(TheColumnNames, "^YG")]
RedGains <- TheColumnNames[str_detect(TheColumnNames, "^R")]

ScatterGains <- TheIntermediate[str_detect(TheIntermediate, "SC-")]
ScatterGains <- ScalePriority(ScatterGains)
LaserGains <- TheIntermediate[str_detect(TheIntermediate, "Laser")]
LaserGains <- ColorPriority(LaserGains)
ScalingGains <- TheIntermediate[str_detect(TheIntermediate, "Scaling")]
ScalingGains <- ColorPriority(ScalingGains)
OtherGains <- c(ScatterGains, LaserGains, ScalingGains)

UltraVioletPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=UltraVioletGains,
                      plotType = "comparison", returntype = "plots",
                      Metadata="Timepoint", strict = TRUE)

VioletPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=VioletGains,
                      plotType = "comparison", returntype = "plots",
                      Metadata="Timepoint", strict = TRUE)

BluePlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=BlueGains,
                      plotType = "comparison", returntype = "plots",
                      Metadata="Timepoint", strict = TRUE)

RedPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=RedGains,
                     plotType = "comparison", returntype = "plots",
                     Metadata="Timepoint", strict = TRUE)

OtherPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=OtherGains,
                     plotType = "comparison", returntype = "plots",
                     Metadata="Timepoint", strict = TRUE)
x <- Gain_4L
TheColumns <- x %>% select(where(~is.numeric(.)||is.integer(.))) %>% colnames()
TheColumns <- setdiff(TheColumns, "TIME")
TheColumnNames <- TheColumns[str_detect(TheColumns, "Gain")]

UltraVioletGains <- TheColumnNames[str_detect(TheColumnNames, "^UV")]
VioletGains <- TheColumnNames[str_detect(TheColumnNames, "^V")]
BlueGains <- TheColumnNames[str_detect(TheColumnNames, "^B")]
#YellowGreenGains <- TheColumnNames[str_detect(TheColumnNames, "^YG")]
RedGains <- TheColumnNames[str_detect(TheColumnNames, "^R")]

ScatterGains <- TheColumnNames[str_detect(TheColumnNames, "SC-")]
ScatterGains <- ScalePriority(ScatterGains)
LaserGains <- TheColumns[str_detect(TheColumns, "Laser")]
LaserGains <- ColorPriority(LaserGains)
ScalingGains <- TheColumns[str_detect(TheColumns, "Scaling")]
ScalingGains <- ColorPriority(ScalingGains)
OtherGains <- c(ScatterGains, LaserGains, ScalingGains)

UltraVioletPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=UltraVioletGains,
                      plotType = "individual", returntype = "plots")

VioletPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=VioletGains,
                      plotType = "individual", returntype = "plots", strict = TRUE)

BluePlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=BlueGains,
                      plotType = "individual", returntype = "plots")

RedPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=RedGains,
                     plotType = "individual", returntype = "plots")

OtherPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=OtherGains,
                     plotType = "individual", returntype = "plots")
x <- Gain_4L
TheColumns <- x %>% select(where(~is.numeric(.)||is.integer(.))) %>% colnames()
TheColumns <- setdiff(TheColumns, "TIME")

TheColumnNames <- TheColumns[str_detect(TheColumns, "rCV")]
UltraVioletGains <- TheColumnNames[str_detect(TheColumnNames, "^UV")]
VioletGains <- TheColumnNames[str_detect(TheColumnNames, "^V")]
BlueGains <- TheColumnNames[str_detect(TheColumnNames, "^B")]
#YellowGreenGains <- TheColumnNames[str_detect(TheColumnNames, "^YG")]
RedGains <- TheColumnNames[str_detect(TheColumnNames, "^R")]

ScatterGains <- TheColumnNames[str_detect(TheColumnNames, "SC-")]
ScatterGains <- ScalePriority(ScatterGains)
LaserGains <- TheColumns[str_detect(TheColumns, "Laser")]
LaserGains <- ColorPriority(LaserGains)
ScalingGains <- TheColumns[str_detect(TheColumns, "Scaling")]
ScalingGains <- ColorPriority(ScalingGains)
OtherGains <- c(ScatterGains)

UltraVioletPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=UltraVioletGains,
                      plotType = "individual", returntype = "plots")

VioletPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=VioletGains,
                      plotType = "individual", returntype = "plots", strict=TRUE)

BluePlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=BlueGains,
                      plotType = "individual", returntype = "plots")

RedPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=RedGains,
                     plotType = "individual", returntype = "plots")

OtherPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=OtherGains,
                     plotType = "individual", returntype = "plots")

MFI

ggplotly(UltraVioletPlotsMFI[[1]])
ggplotly(UltraVioletPlotsMFI[[2]])
ggplotly(UltraVioletPlotsMFI[[3]])
ggplotly(UltraVioletPlotsMFI[[4]])
ggplotly(UltraVioletPlotsMFI[[5]])
ggplotly(UltraVioletPlotsMFI[[6]])
ggplotly(UltraVioletPlotsMFI[[7]])
ggplotly(UltraVioletPlotsMFI[[8]])
ggplotly(UltraVioletPlotsMFI[[9]])
ggplotly(UltraVioletPlotsMFI[[10]])
ggplotly(UltraVioletPlotsMFI[[11]])
ggplotly(UltraVioletPlotsMFI[[12]])
ggplotly(UltraVioletPlotsMFI[[13]])
ggplotly(UltraVioletPlotsMFI[[14]])
ggplotly(UltraVioletPlotsMFI[[15]])
ggplotly(UltraVioletPlotsMFI[[16]])
ggplotly(VioletPlotsMFI[[1]])
ggplotly(VioletPlotsMFI[[2]])
ggplotly(VioletPlotsMFI[[3]])
ggplotly(VioletPlotsMFI[[4]])
ggplotly(VioletPlotsMFI[[5]])
ggplotly(VioletPlotsMFI[[6]])
ggplotly(VioletPlotsMFI[[7]])
ggplotly(VioletPlotsMFI[[8]])
ggplotly(VioletPlotsMFI[[9]])
ggplotly(VioletPlotsMFI[[10]])
ggplotly(VioletPlotsMFI[[11]])
ggplotly(VioletPlotsMFI[[12]])
ggplotly(VioletPlotsMFI[[13]])
ggplotly(VioletPlotsMFI[[14]])
ggplotly(VioletPlotsMFI[[15]])
ggplotly(VioletPlotsMFI[[16]])
ggplotly(BluePlotsMFI[[1]])
ggplotly(BluePlotsMFI[[2]])
ggplotly(BluePlotsMFI[[3]])
ggplotly(BluePlotsMFI[[4]])
ggplotly(BluePlotsMFI[[5]])
ggplotly(BluePlotsMFI[[6]])
ggplotly(BluePlotsMFI[[7]])
ggplotly(BluePlotsMFI[[8]])
ggplotly(BluePlotsMFI[[9]])
ggplotly(BluePlotsMFI[[10]])
ggplotly(BluePlotsMFI[[11]])
ggplotly(BluePlotsMFI[[12]])
ggplotly(BluePlotsMFI[[13]])
ggplotly(BluePlotsMFI[[14]])
ggplotly(RedPlotsMFI[[1]])
ggplotly(RedPlotsMFI[[2]])
ggplotly(RedPlotsMFI[[3]])
ggplotly(RedPlotsMFI[[4]])
ggplotly(RedPlotsMFI[[5]])
ggplotly(RedPlotsMFI[[6]])
ggplotly(RedPlotsMFI[[7]])
ggplotly(RedPlotsMFI[[8]])
ggplotly(OtherPlotsMFI[[1]])
ggplotly(OtherPlotsMFI[[2]])
ggplotly(OtherPlotsMFI[[3]])
ggplotly(OtherPlotsMFI[[4]])
ggplotly(OtherPlotsMFI[[5]])
ggplotly(OtherPlotsMFI[[6]])
ggplotly(OtherPlotsMFI[[7]])
ggplotly(OtherPlotsMFI[[8]]) 
ggplotly(OtherPlotsMFI[[9]])
ggplotly(OtherPlotsMFI[[10]])
ggplotly(OtherPlotsMFI[[11]])
ggplotly(OtherPlotsMFI[[12]])
ggplotly(OtherPlotsMFI[[13]])
ggplotly(OtherPlotsMFI[[14]])

Gain

ggplotly(UltraVioletPlotsGain[[1]])
ggplotly(UltraVioletPlotsGain[[2]])
ggplotly(UltraVioletPlotsGain[[3]])
ggplotly(UltraVioletPlotsGain[[4]])
ggplotly(UltraVioletPlotsGain[[5]])
ggplotly(UltraVioletPlotsGain[[6]])
ggplotly(UltraVioletPlotsGain[[7]])
ggplotly(UltraVioletPlotsGain[[8]])
ggplotly(UltraVioletPlotsGain[[9]])
ggplotly(UltraVioletPlotsGain[[10]])
ggplotly(UltraVioletPlotsGain[[11]])
ggplotly(UltraVioletPlotsGain[[12]])
ggplotly(UltraVioletPlotsGain[[13]])
ggplotly(UltraVioletPlotsGain[[14]])
ggplotly(UltraVioletPlotsGain[[15]])
ggplotly(UltraVioletPlotsGain[[16]])
ggplotly(VioletPlotsGain[[1]])
ggplotly(VioletPlotsGain[[2]])
ggplotly(VioletPlotsGain[[3]])
ggplotly(VioletPlotsGain[[4]])
ggplotly(VioletPlotsGain[[5]])
ggplotly(VioletPlotsGain[[6]])
ggplotly(VioletPlotsGain[[7]])
ggplotly(VioletPlotsGain[[8]])
ggplotly(VioletPlotsGain[[9]])
ggplotly(VioletPlotsGain[[10]])
ggplotly(VioletPlotsGain[[11]])
ggplotly(VioletPlotsGain[[12]])
ggplotly(VioletPlotsGain[[13]])
ggplotly(VioletPlotsGain[[14]])
ggplotly(VioletPlotsGain[[15]])
ggplotly(VioletPlotsGain[[16]])
ggplotly(BluePlotsGain[[1]])
ggplotly(BluePlotsGain[[2]])
ggplotly(BluePlotsGain[[3]])
ggplotly(BluePlotsGain[[4]])
ggplotly(BluePlotsGain[[5]])
ggplotly(BluePlotsGain[[6]])
ggplotly(BluePlotsGain[[7]])
ggplotly(BluePlotsGain[[8]])
ggplotly(BluePlotsGain[[9]])
ggplotly(BluePlotsGain[[10]])
ggplotly(BluePlotsGain[[11]])
ggplotly(BluePlotsGain[[12]])
ggplotly(BluePlotsGain[[13]])
ggplotly(BluePlotsGain[[14]])
ggplotly(RedPlotsGain[[1]])
ggplotly(RedPlotsGain[[2]])
ggplotly(RedPlotsGain[[3]])
ggplotly(RedPlotsGain[[4]])
ggplotly(RedPlotsGain[[5]])
ggplotly(RedPlotsGain[[6]])
ggplotly(RedPlotsGain[[7]])
ggplotly(RedPlotsGain[[8]])
ggplotly(OtherPlotsGain[[1]])
ggplotly(OtherPlotsGain[[2]])
ggplotly(OtherPlotsGain[[3]])
ggplotly(OtherPlotsGain[[4]])
ggplotly(OtherPlotsGain[[5]])
ggplotly(OtherPlotsGain[[6]])
ggplotly(OtherPlotsGain[[7]])
ggplotly(OtherPlotsGain[[8]])
ggplotly(OtherPlotsGain[[9]])
ggplotly(OtherPlotsGain[[10]])

rCV

ggplotly(UltraVioletPlotsRCV[[1]])
ggplotly(UltraVioletPlotsRCV[[2]])
ggplotly(UltraVioletPlotsRCV[[3]])
ggplotly(UltraVioletPlotsRCV[[4]])
ggplotly(UltraVioletPlotsRCV[[5]])
ggplotly(UltraVioletPlotsRCV[[6]])
ggplotly(UltraVioletPlotsRCV[[7]])
ggplotly(UltraVioletPlotsRCV[[8]])
ggplotly(UltraVioletPlotsRCV[[9]])
ggplotly(UltraVioletPlotsRCV[[10]])
ggplotly(UltraVioletPlotsRCV[[11]])
ggplotly(UltraVioletPlotsRCV[[12]])
ggplotly(UltraVioletPlotsRCV[[13]])
ggplotly(UltraVioletPlotsRCV[[14]])
ggplotly(UltraVioletPlotsRCV[[15]])
ggplotly(UltraVioletPlotsRCV[[16]])
ggplotly(VioletPlotsRCV[[1]])
ggplotly(VioletPlotsRCV[[2]])
ggplotly(VioletPlotsRCV[[3]])
ggplotly(VioletPlotsRCV[[4]])
ggplotly(VioletPlotsRCV[[5]])
ggplotly(VioletPlotsRCV[[6]])
ggplotly(VioletPlotsRCV[[7]])
ggplotly(VioletPlotsRCV[[8]])
ggplotly(VioletPlotsRCV[[9]])
ggplotly(VioletPlotsRCV[[10]])
ggplotly(VioletPlotsRCV[[11]])
ggplotly(VioletPlotsRCV[[12]])
ggplotly(VioletPlotsRCV[[13]])
ggplotly(VioletPlotsRCV[[14]])
ggplotly(VioletPlotsRCV[[15]])
ggplotly(VioletPlotsRCV[[16]])
ggplotly(BluePlotsRCV[[1]])
ggplotly(BluePlotsRCV[[2]])
ggplotly(BluePlotsRCV[[3]])
ggplotly(BluePlotsRCV[[4]])
ggplotly(BluePlotsRCV[[5]])
ggplotly(BluePlotsRCV[[6]])
ggplotly(BluePlotsRCV[[7]])
ggplotly(BluePlotsRCV[[8]])
ggplotly(BluePlotsRCV[[9]])
ggplotly(BluePlotsRCV[[10]])
ggplotly(BluePlotsRCV[[11]])
ggplotly(BluePlotsRCV[[12]])
ggplotly(BluePlotsRCV[[13]])
ggplotly(BluePlotsRCV[[14]])
ggplotly(RedPlotsRCV[[1]])
ggplotly(RedPlotsRCV[[2]])
ggplotly(RedPlotsRCV[[3]])
ggplotly(RedPlotsRCV[[4]])
ggplotly(RedPlotsRCV[[5]])
ggplotly(RedPlotsRCV[[6]])
ggplotly(RedPlotsRCV[[7]])
ggplotly(RedPlotsRCV[[8]])
ggplotly(OtherPlotsRCV[[1]])
ggplotly(OtherPlotsRCV[[2]])
ggplotly(OtherPlotsRCV[[3]])

5L

x <- MFI_5L
x <- x %>% dplyr::filter(Timepoint %in% c("Before", "After"))
TheColumns <- x %>% select(where(~is.numeric(.)||is.integer(.))) %>% colnames()
TheColumns <- setdiff(TheColumns, "TIME")
TheIntermediate <- TheColumns[!str_detect(TheColumns, "Gain")]
TheColumnNames <- TheIntermediate[str_detect(TheIntermediate, "-A")]
  
UltraVioletGains <- TheColumnNames[str_detect(TheColumnNames, "^UV")]
VioletGains <- TheColumnNames[str_detect(TheColumnNames, "^V")]
BlueGains <- TheColumnNames[str_detect(TheColumnNames, "^B")]
YellowGreenGains <- TheColumnNames[str_detect(TheColumnNames, "^YG")]
RedGains <- TheColumnNames[str_detect(TheColumnNames, "^R")]

ScatterGains <- TheIntermediate[str_detect(TheIntermediate, "SC-")]
ScatterGains <- ScalePriority(ScatterGains)
LaserGains <- TheIntermediate[str_detect(TheIntermediate, "Laser")]
LaserGains <- ColorPriority(LaserGains)
ScalingGains <- TheIntermediate[str_detect(TheIntermediate, "Scaling")]
ScalingGains <- ColorPriority(ScalingGains)
OtherGains <- c(ScatterGains, LaserGains, ScalingGains)

UltraVioletPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=UltraVioletGains,
                      plotType = "comparison", returntype = "plots",
                      Metadata="Timepoint", strict = TRUE)

VioletPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=VioletGains,
                      plotType = "comparison", returntype = "plots",
                      Metadata="Timepoint", strict = TRUE)

BluePlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=BlueGains,
                      plotType = "comparison", returntype = "plots",
                      Metadata="Timepoint", strict = TRUE)

YellowGreenPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=YellowGreenGains,
                      plotType = "comparison", returntype = "plots",
                      Metadata="Timepoint", strict = TRUE)

RedPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=RedGains,
                     plotType = "comparison", returntype = "plots",
                     Metadata="Timepoint", strict = TRUE)

OtherPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=OtherGains,
                     plotType = "comparison", returntype = "plots",
                     Metadata="Timepoint", strict = TRUE)
x <- Gain_5L
TheColumns <- x %>% select(where(~is.numeric(.)||is.integer(.))) %>% colnames()
TheColumns <- setdiff(TheColumns, "TIME")
TheColumnNames <- TheColumns[str_detect(TheColumns, "Gain")]

UltraVioletGains <- TheColumnNames[str_detect(TheColumnNames, "^UV")]
VioletGains <- TheColumnNames[str_detect(TheColumnNames, "^V")]
BlueGains <- TheColumnNames[str_detect(TheColumnNames, "^B")]
YellowGreenGains <- TheColumnNames[str_detect(TheColumnNames, "^YG")]
RedGains <- TheColumnNames[str_detect(TheColumnNames, "^R")]

ScatterGains <- TheColumnNames[str_detect(TheColumnNames, "SC-")]
ScatterGains <- ScalePriority(ScatterGains)
LaserGains <- TheColumns[str_detect(TheColumns, "Laser")]
LaserGains <- ColorPriority(LaserGains)
ScalingGains <- TheColumns[str_detect(TheColumns, "Scaling")]
ScalingGains <- ColorPriority(ScalingGains)
OtherGains <- c(ScatterGains, LaserGains, ScalingGains)

UltraVioletPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=UltraVioletGains,
                      plotType = "individual", returntype = "plots")

VioletPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=VioletGains,
                      plotType = "individual", returntype = "plots", strict = TRUE)

BluePlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=BlueGains,
                      plotType = "individual", returntype = "plots")

YellowGreenPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=YellowGreenGains,
                      plotType = "individual", returntype = "plots")

RedPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=RedGains,
                     plotType = "individual", returntype = "plots")

OtherPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=OtherGains,
                     plotType = "individual", returntype = "plots")
x <- Gain_5L
TheColumns <- x %>% select(where(~is.numeric(.)||is.integer(.))) %>% colnames()
TheColumns <- setdiff(TheColumns, "TIME")

TheColumnNames <- TheColumns[str_detect(TheColumns, "rCV")]
UltraVioletGains <- TheColumnNames[str_detect(TheColumnNames, "^UV")]
VioletGains <- TheColumnNames[str_detect(TheColumnNames, "^V")]
BlueGains <- TheColumnNames[str_detect(TheColumnNames, "^B")]
YellowGreenGains <- TheColumnNames[str_detect(TheColumnNames, "^YG")]
RedGains <- TheColumnNames[str_detect(TheColumnNames, "^R")]

ScatterGains <- TheColumnNames[str_detect(TheColumnNames, "SC-")]
ScatterGains <- ScalePriority(ScatterGains)
LaserGains <- TheColumns[str_detect(TheColumns, "Laser")]
LaserGains <- ColorPriority(LaserGains)
ScalingGains <- TheColumns[str_detect(TheColumns, "Scaling")]
ScalingGains <- ColorPriority(ScalingGains)
OtherGains <- c(ScatterGains)

UltraVioletPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=UltraVioletGains,
                      plotType = "individual", returntype = "plots")

VioletPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=VioletGains,
                      plotType = "individual", returntype = "plots", strict=TRUE)

BluePlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=BlueGains,
                      plotType = "individual", returntype = "plots")

YellowGreenPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=YellowGreenGains,
                      plotType = "individual", returntype = "plots")

RedPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=RedGains,
                     plotType = "individual", returntype = "plots")

OtherPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=OtherGains,
                     plotType = "individual", returntype = "plots")

MFI

ggplotly(UltraVioletPlotsMFI[[1]])
ggplotly(UltraVioletPlotsMFI[[2]])
ggplotly(UltraVioletPlotsMFI[[3]])
ggplotly(UltraVioletPlotsMFI[[4]])
ggplotly(UltraVioletPlotsMFI[[5]])
ggplotly(UltraVioletPlotsMFI[[6]])
ggplotly(UltraVioletPlotsMFI[[7]])
ggplotly(UltraVioletPlotsMFI[[8]])
ggplotly(UltraVioletPlotsMFI[[9]])
ggplotly(UltraVioletPlotsMFI[[10]])
ggplotly(UltraVioletPlotsMFI[[11]])
ggplotly(UltraVioletPlotsMFI[[12]])
ggplotly(UltraVioletPlotsMFI[[13]])
ggplotly(UltraVioletPlotsMFI[[14]])
ggplotly(UltraVioletPlotsMFI[[15]])
ggplotly(UltraVioletPlotsMFI[[16]])
ggplotly(VioletPlotsMFI[[1]])
ggplotly(VioletPlotsMFI[[2]])
ggplotly(VioletPlotsMFI[[3]])
ggplotly(VioletPlotsMFI[[4]])
ggplotly(VioletPlotsMFI[[5]])
ggplotly(VioletPlotsMFI[[6]])
ggplotly(VioletPlotsMFI[[7]])
ggplotly(VioletPlotsMFI[[8]])
ggplotly(VioletPlotsMFI[[9]])
ggplotly(VioletPlotsMFI[[10]])
ggplotly(VioletPlotsMFI[[11]])
ggplotly(VioletPlotsMFI[[12]])
ggplotly(VioletPlotsMFI[[13]])
ggplotly(VioletPlotsMFI[[14]])
ggplotly(VioletPlotsMFI[[15]])
ggplotly(VioletPlotsMFI[[16]])
ggplotly(BluePlotsMFI[[1]])
ggplotly(BluePlotsMFI[[2]])
ggplotly(BluePlotsMFI[[3]])
ggplotly(BluePlotsMFI[[4]])
ggplotly(BluePlotsMFI[[5]])
ggplotly(BluePlotsMFI[[6]])
ggplotly(BluePlotsMFI[[7]])
ggplotly(BluePlotsMFI[[8]])
ggplotly(BluePlotsMFI[[9]])
ggplotly(BluePlotsMFI[[10]])
ggplotly(BluePlotsMFI[[11]])
ggplotly(BluePlotsMFI[[12]])
ggplotly(BluePlotsMFI[[13]])
ggplotly(BluePlotsMFI[[14]])
ggplotly(YellowGreenPlotsMFI[[1]])
ggplotly(YellowGreenPlotsMFI[[2]])
ggplotly(YellowGreenPlotsMFI[[3]])
ggplotly(YellowGreenPlotsMFI[[4]])
ggplotly(YellowGreenPlotsMFI[[5]])
ggplotly(YellowGreenPlotsMFI[[6]])
ggplotly(YellowGreenPlotsMFI[[7]])
ggplotly(YellowGreenPlotsMFI[[8]])
ggplotly(YellowGreenPlotsMFI[[9]])
ggplotly(YellowGreenPlotsMFI[[10]])
ggplotly(RedPlotsMFI[[1]])
ggplotly(RedPlotsMFI[[2]])
ggplotly(RedPlotsMFI[[3]])
ggplotly(RedPlotsMFI[[4]])
ggplotly(RedPlotsMFI[[5]])
ggplotly(RedPlotsMFI[[6]])
ggplotly(RedPlotsMFI[[7]])
ggplotly(RedPlotsMFI[[8]])
ggplotly(OtherPlotsMFI[[1]])
ggplotly(OtherPlotsMFI[[2]])
ggplotly(OtherPlotsMFI[[3]])
ggplotly(OtherPlotsMFI[[4]])
ggplotly(OtherPlotsMFI[[5]])
ggplotly(OtherPlotsMFI[[6]])
ggplotly(OtherPlotsMFI[[7]])
ggplotly(OtherPlotsMFI[[8]]) 
ggplotly(OtherPlotsMFI[[9]]) 
ggplotly(OtherPlotsMFI[[10]])
ggplotly(OtherPlotsMFI[[11]])
ggplotly(OtherPlotsMFI[[12]])
ggplotly(OtherPlotsMFI[[13]])
ggplotly(OtherPlotsMFI[[14]])
ggplotly(OtherPlotsMFI[[15]])
ggplotly(OtherPlotsMFI[[16]])

Gain

ggplotly(UltraVioletPlotsGain[[1]])
ggplotly(UltraVioletPlotsGain[[2]])
ggplotly(UltraVioletPlotsGain[[3]])
ggplotly(UltraVioletPlotsGain[[4]])
ggplotly(UltraVioletPlotsGain[[5]])
ggplotly(UltraVioletPlotsGain[[6]])
ggplotly(UltraVioletPlotsGain[[7]])
ggplotly(UltraVioletPlotsGain[[8]])
ggplotly(UltraVioletPlotsGain[[9]])
ggplotly(UltraVioletPlotsGain[[10]])
ggplotly(UltraVioletPlotsGain[[11]])
ggplotly(UltraVioletPlotsGain[[12]])
ggplotly(UltraVioletPlotsGain[[13]])
ggplotly(UltraVioletPlotsGain[[14]])
ggplotly(UltraVioletPlotsGain[[15]])
ggplotly(UltraVioletPlotsGain[[16]])
ggplotly(VioletPlotsGain[[1]])
ggplotly(VioletPlotsGain[[2]])
ggplotly(VioletPlotsGain[[3]])
ggplotly(VioletPlotsGain[[4]])
ggplotly(VioletPlotsGain[[5]])
ggplotly(VioletPlotsGain[[6]])
ggplotly(VioletPlotsGain[[7]])
ggplotly(VioletPlotsGain[[8]])
ggplotly(VioletPlotsGain[[9]])
ggplotly(VioletPlotsGain[[10]])
ggplotly(VioletPlotsGain[[11]])
ggplotly(VioletPlotsGain[[12]])
ggplotly(VioletPlotsGain[[13]])
ggplotly(VioletPlotsGain[[14]])
ggplotly(VioletPlotsGain[[15]])
ggplotly(VioletPlotsGain[[16]])
ggplotly(BluePlotsGain[[1]])
ggplotly(BluePlotsGain[[2]])
ggplotly(BluePlotsGain[[3]])
ggplotly(BluePlotsGain[[4]])
ggplotly(BluePlotsGain[[5]])
ggplotly(BluePlotsGain[[6]])
ggplotly(BluePlotsGain[[7]])
ggplotly(BluePlotsGain[[8]])
ggplotly(BluePlotsGain[[9]])
ggplotly(BluePlotsGain[[10]])
ggplotly(BluePlotsGain[[11]])
ggplotly(BluePlotsGain[[12]])
ggplotly(BluePlotsGain[[13]])
ggplotly(BluePlotsGain[[14]])
ggplotly(YellowGreenPlotsGain[[1]])
ggplotly(YellowGreenPlotsGain[[2]])
ggplotly(YellowGreenPlotsGain[[3]])
ggplotly(YellowGreenPlotsGain[[4]])
ggplotly(YellowGreenPlotsGain[[5]])
ggplotly(YellowGreenPlotsGain[[6]])
ggplotly(YellowGreenPlotsGain[[7]])
ggplotly(YellowGreenPlotsGain[[8]])
ggplotly(YellowGreenPlotsGain[[9]])
ggplotly(YellowGreenPlotsGain[[10]])
ggplotly(RedPlotsGain[[1]])
ggplotly(RedPlotsGain[[2]])
ggplotly(RedPlotsGain[[3]])
ggplotly(RedPlotsGain[[4]])
ggplotly(RedPlotsGain[[5]])
ggplotly(RedPlotsGain[[6]])
ggplotly(RedPlotsGain[[7]])
ggplotly(RedPlotsGain[[8]])
ggplotly(OtherPlotsGain[[1]])
ggplotly(OtherPlotsGain[[2]])
ggplotly(OtherPlotsGain[[3]])
ggplotly(OtherPlotsGain[[4]])
ggplotly(OtherPlotsGain[[5]])
ggplotly(OtherPlotsGain[[6]])
ggplotly(OtherPlotsGain[[7]])
ggplotly(OtherPlotsGain[[8]])
ggplotly(OtherPlotsGain[[9]])
ggplotly(OtherPlotsGain[[10]])
ggplotly(OtherPlotsGain[[11]])
ggplotly(OtherPlotsGain[[12]])

rCV

ggplotly(UltraVioletPlotsRCV[[1]])
ggplotly(UltraVioletPlotsRCV[[2]])
ggplotly(UltraVioletPlotsRCV[[3]])
ggplotly(UltraVioletPlotsRCV[[4]])
ggplotly(UltraVioletPlotsRCV[[5]])
ggplotly(UltraVioletPlotsRCV[[6]])
ggplotly(UltraVioletPlotsRCV[[7]])
ggplotly(UltraVioletPlotsRCV[[8]])
ggplotly(UltraVioletPlotsRCV[[9]])
ggplotly(UltraVioletPlotsRCV[[10]])
ggplotly(UltraVioletPlotsRCV[[11]])
ggplotly(UltraVioletPlotsRCV[[12]])
ggplotly(UltraVioletPlotsRCV[[13]])
ggplotly(UltraVioletPlotsRCV[[14]])
ggplotly(UltraVioletPlotsRCV[[15]])
ggplotly(UltraVioletPlotsRCV[[16]])
ggplotly(VioletPlotsRCV[[1]])
ggplotly(VioletPlotsRCV[[2]])
ggplotly(VioletPlotsRCV[[3]])
ggplotly(VioletPlotsRCV[[4]])
ggplotly(VioletPlotsRCV[[5]])
ggplotly(VioletPlotsRCV[[6]])
ggplotly(VioletPlotsRCV[[7]])
ggplotly(VioletPlotsRCV[[8]])
ggplotly(VioletPlotsRCV[[9]])
ggplotly(VioletPlotsRCV[[10]])
ggplotly(VioletPlotsRCV[[11]])
ggplotly(VioletPlotsRCV[[12]])
ggplotly(VioletPlotsRCV[[13]])
ggplotly(VioletPlotsRCV[[14]])
ggplotly(VioletPlotsRCV[[15]])
ggplotly(VioletPlotsRCV[[16]])
ggplotly(BluePlotsRCV[[1]])
ggplotly(BluePlotsRCV[[2]])
ggplotly(BluePlotsRCV[[3]])
ggplotly(BluePlotsRCV[[4]])
ggplotly(BluePlotsRCV[[5]])
ggplotly(BluePlotsRCV[[6]])
ggplotly(BluePlotsRCV[[7]])
ggplotly(BluePlotsRCV[[8]])
ggplotly(BluePlotsRCV[[9]])
ggplotly(BluePlotsRCV[[10]])
ggplotly(BluePlotsRCV[[11]])
ggplotly(BluePlotsRCV[[12]])
ggplotly(BluePlotsRCV[[13]])
ggplotly(BluePlotsRCV[[14]])
ggplotly(YellowGreenPlotsRCV[[1]])
ggplotly(YellowGreenPlotsRCV[[2]])
ggplotly(YellowGreenPlotsRCV[[3]])
ggplotly(YellowGreenPlotsRCV[[4]])
ggplotly(YellowGreenPlotsRCV[[5]])
ggplotly(YellowGreenPlotsRCV[[6]])
ggplotly(YellowGreenPlotsRCV[[7]])
ggplotly(YellowGreenPlotsRCV[[8]])
ggplotly(YellowGreenPlotsRCV[[9]])
ggplotly(YellowGreenPlotsRCV[[10]])
ggplotly(RedPlotsRCV[[1]])
ggplotly(RedPlotsRCV[[2]])
ggplotly(RedPlotsRCV[[3]])
ggplotly(RedPlotsRCV[[4]])
ggplotly(RedPlotsRCV[[5]])
ggplotly(RedPlotsRCV[[6]])
ggplotly(RedPlotsRCV[[7]])
ggplotly(RedPlotsRCV[[8]])
ggplotly(OtherPlotsRCV[[1]])
ggplotly(OtherPlotsRCV[[2]])
ggplotly(OtherPlotsRCV[[3]])

CS

x <- MFI_CS
x <- x %>% dplyr::filter(Timepoint %in% c("Before", "After"))
TheColumns <- x %>% select(where(~is.numeric(.)||is.integer(.))) %>% colnames()
TheColumns <- setdiff(TheColumns, "TIME")
TheIntermediate <- TheColumns[!str_detect(TheColumns, "Gain")]
TheColumnNames <- TheIntermediate[str_detect(TheIntermediate, "-A")]
  
UltraVioletGains <- TheColumnNames[str_detect(TheColumnNames, "^UV")]
VioletGains <- TheColumnNames[str_detect(TheColumnNames, "^V")]
BlueGains <- TheColumnNames[str_detect(TheColumnNames, "^B")]
YellowGreenGains <- TheColumnNames[str_detect(TheColumnNames, "^YG")]
RedGains <- TheColumnNames[str_detect(TheColumnNames, "^R")]

ScatterGains <- TheIntermediate[str_detect(TheIntermediate, "SC-")]
ScatterGains <- ScalePriority(ScatterGains)
LaserGains <- TheIntermediate[str_detect(TheIntermediate, "Laser")]
LaserGains <- ColorPriority(LaserGains)
ScalingGains <- TheIntermediate[str_detect(TheIntermediate, "Scaling")]
ScalingGains <- ColorPriority(ScalingGains)
OtherGains <- c(ScatterGains, LaserGains, ScalingGains)

UltraVioletPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=UltraVioletGains,
                      plotType = "comparison", returntype = "plots",
                      Metadata="Timepoint", strict = TRUE)

VioletPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=VioletGains,
                      plotType = "comparison", returntype = "plots",
                      Metadata="Timepoint", strict = TRUE)

BluePlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=BlueGains,
                      plotType = "comparison", returntype = "plots",
                      Metadata="Timepoint", strict = TRUE)

YellowGreenPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=YellowGreenGains,
                      plotType = "comparison", returntype = "plots",
                      Metadata="Timepoint", strict = TRUE)

RedPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=RedGains,
                     plotType = "comparison", returntype = "plots",
                     Metadata="Timepoint", strict = TRUE)

OtherPlotsMFI <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=OtherGains,
                     plotType = "comparison", returntype = "plots",
                     Metadata="Timepoint", strict = TRUE)
x <- Gain_CS
TheColumns <- x %>% select(where(~is.numeric(.)||is.integer(.))) %>% colnames()
TheColumns <- setdiff(TheColumns, "TIME")
TheColumnNames <- TheColumns[str_detect(TheColumns, "Gain")]

UltraVioletGains <- TheColumnNames[str_detect(TheColumnNames, "^UV")]
VioletGains <- TheColumnNames[str_detect(TheColumnNames, "^V")]
BlueGains <- TheColumnNames[str_detect(TheColumnNames, "^B")]
YellowGreenGains <- TheColumnNames[str_detect(TheColumnNames, "^YG")]
RedGains <- TheColumnNames[str_detect(TheColumnNames, "^R")]

ScatterGains <- TheColumnNames[str_detect(TheColumnNames, "SC-")]
ScatterGains <- ScalePriority(ScatterGains)
LaserGains <- TheColumns[str_detect(TheColumns, "Laser")]
LaserGains <- ColorPriority(LaserGains)
ScalingGains <- TheColumns[str_detect(TheColumns, "Scaling")]
ScalingGains <- ColorPriority(ScalingGains)
OtherGains <- c(ScatterGains, LaserGains, ScalingGains)

UltraVioletPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=UltraVioletGains,
                      plotType = "individual", returntype = "plots")

VioletPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=VioletGains,
                      plotType = "individual", returntype = "plots", strict = TRUE)

BluePlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=BlueGains,
                      plotType = "individual", returntype = "plots")

YellowGreenPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=YellowGreenGains,
                      plotType = "individual", returntype = "plots")

RedPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=RedGains,
                     plotType = "individual", returntype = "plots")

OtherPlotsGain <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=OtherGains,
                     plotType = "individual", returntype = "plots")
x <- Gain_CS
TheColumns <- x %>% select(where(~is.numeric(.)||is.integer(.))) %>% colnames()
TheColumns <- setdiff(TheColumns, "TIME")

TheColumnNames <- TheColumns[str_detect(TheColumns, "rCV")]
UltraVioletGains <- TheColumnNames[str_detect(TheColumnNames, "^UV")]
VioletGains <- TheColumnNames[str_detect(TheColumnNames, "^V")]
BlueGains <- TheColumnNames[str_detect(TheColumnNames, "^B")]
YellowGreenGains <- TheColumnNames[str_detect(TheColumnNames, "^YG")]
RedGains <- TheColumnNames[str_detect(TheColumnNames, "^R")]

ScatterGains <- TheColumnNames[str_detect(TheColumnNames, "SC-")]
ScatterGains <- ScalePriority(ScatterGains)
LaserGains <- TheColumns[str_detect(TheColumns, "Laser")]
LaserGains <- ColorPriority(LaserGains)
ScalingGains <- TheColumns[str_detect(TheColumns, "Scaling")]
ScalingGains <- ColorPriority(ScalingGains)
OtherGains <- c(ScatterGains)

UltraVioletPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=UltraVioletGains,
                      plotType = "individual", returntype = "plots")

VioletPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=VioletGains,
                      plotType = "individual", returntype = "plots", strict=TRUE)

BluePlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=BlueGains,
                      plotType = "individual", returntype = "plots")

YellowGreenPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=YellowGreenGains,
                      plotType = "individual", returntype = "plots")

RedPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=RedGains,
                     plotType = "individual", returntype = "plots")

OtherPlotsRCV <- QC_Plots(x=x, FailedFlag=TRUE, MeasurementType=OtherGains,
                     plotType = "individual", returntype = "plots")

MFI

ggplotly(UltraVioletPlotsMFI[[1]])
ggplotly(UltraVioletPlotsMFI[[2]])
ggplotly(UltraVioletPlotsMFI[[3]])
ggplotly(UltraVioletPlotsMFI[[4]])
ggplotly(UltraVioletPlotsMFI[[5]])
ggplotly(UltraVioletPlotsMFI[[6]])
ggplotly(UltraVioletPlotsMFI[[7]])
ggplotly(UltraVioletPlotsMFI[[8]])
ggplotly(UltraVioletPlotsMFI[[9]])
ggplotly(UltraVioletPlotsMFI[[10]])
ggplotly(UltraVioletPlotsMFI[[11]])
ggplotly(UltraVioletPlotsMFI[[12]])
ggplotly(UltraVioletPlotsMFI[[13]])
ggplotly(UltraVioletPlotsMFI[[14]])
ggplotly(UltraVioletPlotsMFI[[15]])
ggplotly(UltraVioletPlotsMFI[[16]])
ggplotly(VioletPlotsMFI[[1]])
ggplotly(VioletPlotsMFI[[2]])
ggplotly(VioletPlotsMFI[[3]])
ggplotly(VioletPlotsMFI[[4]])
ggplotly(VioletPlotsMFI[[5]])
ggplotly(VioletPlotsMFI[[6]])
ggplotly(VioletPlotsMFI[[7]])
ggplotly(VioletPlotsMFI[[8]])
ggplotly(VioletPlotsMFI[[9]])
ggplotly(VioletPlotsMFI[[10]])
ggplotly(VioletPlotsMFI[[11]])
ggplotly(VioletPlotsMFI[[12]])
ggplotly(VioletPlotsMFI[[13]])
ggplotly(VioletPlotsMFI[[14]])
ggplotly(VioletPlotsMFI[[15]])
ggplotly(VioletPlotsMFI[[16]])
ggplotly(BluePlotsMFI[[1]])
ggplotly(BluePlotsMFI[[2]])
ggplotly(BluePlotsMFI[[3]])
ggplotly(BluePlotsMFI[[4]])
ggplotly(BluePlotsMFI[[5]])
ggplotly(BluePlotsMFI[[6]])
ggplotly(BluePlotsMFI[[7]])
ggplotly(BluePlotsMFI[[8]])
ggplotly(BluePlotsMFI[[9]])
ggplotly(BluePlotsMFI[[10]])
ggplotly(BluePlotsMFI[[11]])
ggplotly(BluePlotsMFI[[12]])
ggplotly(BluePlotsMFI[[13]])
ggplotly(BluePlotsMFI[[14]])
ggplotly(YellowGreenPlotsMFI[[1]])
ggplotly(YellowGreenPlotsMFI[[2]])
ggplotly(YellowGreenPlotsMFI[[3]])
ggplotly(YellowGreenPlotsMFI[[4]])
ggplotly(YellowGreenPlotsMFI[[5]])
ggplotly(YellowGreenPlotsMFI[[6]])
ggplotly(YellowGreenPlotsMFI[[7]])
ggplotly(YellowGreenPlotsMFI[[8]])
ggplotly(YellowGreenPlotsMFI[[9]])
ggplotly(YellowGreenPlotsMFI[[10]])
ggplotly(RedPlotsMFI[[1]])
ggplotly(RedPlotsMFI[[2]])
ggplotly(RedPlotsMFI[[3]])
ggplotly(RedPlotsMFI[[4]])
ggplotly(RedPlotsMFI[[5]])
ggplotly(RedPlotsMFI[[6]])
ggplotly(RedPlotsMFI[[7]])
ggplotly(RedPlotsMFI[[8]])
ggplotly(OtherPlotsMFI[[1]])
ggplotly(OtherPlotsMFI[[2]])
ggplotly(OtherPlotsMFI[[3]])
ggplotly(OtherPlotsMFI[[4]])
ggplotly(OtherPlotsMFI[[5]])
ggplotly(OtherPlotsMFI[[6]])
ggplotly(OtherPlotsMFI[[7]])
ggplotly(OtherPlotsMFI[[8]]) 
ggplotly(OtherPlotsMFI[[9]]) 
ggplotly(OtherPlotsMFI[[10]])
ggplotly(OtherPlotsMFI[[11]])
ggplotly(OtherPlotsMFI[[12]])
ggplotly(OtherPlotsMFI[[13]])
ggplotly(OtherPlotsMFI[[14]])
ggplotly(OtherPlotsMFI[[15]])
ggplotly(OtherPlotsMFI[[16]])

Gain

ggplotly(UltraVioletPlotsGain[[1]])
ggplotly(UltraVioletPlotsGain[[2]])
ggplotly(UltraVioletPlotsGain[[3]])
ggplotly(UltraVioletPlotsGain[[4]])
ggplotly(UltraVioletPlotsGain[[5]])
ggplotly(UltraVioletPlotsGain[[6]])
ggplotly(UltraVioletPlotsGain[[7]])
ggplotly(UltraVioletPlotsGain[[8]])
ggplotly(UltraVioletPlotsGain[[9]])
ggplotly(UltraVioletPlotsGain[[10]])
ggplotly(UltraVioletPlotsGain[[11]])
ggplotly(UltraVioletPlotsGain[[12]])
ggplotly(UltraVioletPlotsGain[[13]])
ggplotly(UltraVioletPlotsGain[[14]])
ggplotly(UltraVioletPlotsGain[[15]])
ggplotly(UltraVioletPlotsGain[[16]])
ggplotly(VioletPlotsGain[[1]])
ggplotly(VioletPlotsGain[[2]])
ggplotly(VioletPlotsGain[[3]])
ggplotly(VioletPlotsGain[[4]])
ggplotly(VioletPlotsGain[[5]])
ggplotly(VioletPlotsGain[[6]])
ggplotly(VioletPlotsGain[[7]])
ggplotly(VioletPlotsGain[[8]])
ggplotly(VioletPlotsGain[[9]])
ggplotly(VioletPlotsGain[[10]])
ggplotly(VioletPlotsGain[[11]])
ggplotly(VioletPlotsGain[[12]])
ggplotly(VioletPlotsGain[[13]])
ggplotly(VioletPlotsGain[[14]])
ggplotly(VioletPlotsGain[[15]])
ggplotly(VioletPlotsGain[[16]])
ggplotly(BluePlotsGain[[1]])
ggplotly(BluePlotsGain[[2]])
ggplotly(BluePlotsGain[[3]])
ggplotly(BluePlotsGain[[4]])
ggplotly(BluePlotsGain[[5]])
ggplotly(BluePlotsGain[[6]])
ggplotly(BluePlotsGain[[7]])
ggplotly(BluePlotsGain[[8]])
ggplotly(BluePlotsGain[[9]])
ggplotly(BluePlotsGain[[10]])
ggplotly(BluePlotsGain[[11]])
ggplotly(BluePlotsGain[[12]])
ggplotly(BluePlotsGain[[13]])
ggplotly(BluePlotsGain[[14]])
ggplotly(YellowGreenPlotsGain[[1]])
ggplotly(YellowGreenPlotsGain[[2]])
ggplotly(YellowGreenPlotsGain[[3]])
ggplotly(YellowGreenPlotsGain[[4]])
ggplotly(YellowGreenPlotsGain[[5]])
ggplotly(YellowGreenPlotsGain[[6]])
ggplotly(YellowGreenPlotsGain[[7]])
ggplotly(YellowGreenPlotsGain[[8]])
ggplotly(YellowGreenPlotsGain[[9]])
ggplotly(YellowGreenPlotsGain[[10]])
ggplotly(RedPlotsGain[[1]])
ggplotly(RedPlotsGain[[2]])
ggplotly(RedPlotsGain[[3]])
ggplotly(RedPlotsGain[[4]])
ggplotly(RedPlotsGain[[5]])
ggplotly(RedPlotsGain[[6]])
ggplotly(RedPlotsGain[[7]])
ggplotly(RedPlotsGain[[8]])
ggplotly(OtherPlotsGain[[1]])
ggplotly(OtherPlotsGain[[2]])
ggplotly(OtherPlotsGain[[3]])
ggplotly(OtherPlotsGain[[4]])
ggplotly(OtherPlotsGain[[5]])
ggplotly(OtherPlotsGain[[6]])
ggplotly(OtherPlotsGain[[7]])
ggplotly(OtherPlotsGain[[8]])
ggplotly(OtherPlotsGain[[9]])
ggplotly(OtherPlotsGain[[10]])
ggplotly(OtherPlotsGain[[11]])
ggplotly(OtherPlotsGain[[12]])

rCV

ggplotly(UltraVioletPlotsRCV[[1]])
ggplotly(UltraVioletPlotsRCV[[2]])
ggplotly(UltraVioletPlotsRCV[[3]])
ggplotly(UltraVioletPlotsRCV[[4]])
ggplotly(UltraVioletPlotsRCV[[5]])
ggplotly(UltraVioletPlotsRCV[[6]])
ggplotly(UltraVioletPlotsRCV[[7]])
ggplotly(UltraVioletPlotsRCV[[8]])
ggplotly(UltraVioletPlotsRCV[[9]])
ggplotly(UltraVioletPlotsRCV[[10]])
ggplotly(UltraVioletPlotsRCV[[11]])
ggplotly(UltraVioletPlotsRCV[[12]])
ggplotly(UltraVioletPlotsRCV[[13]])
ggplotly(UltraVioletPlotsRCV[[14]])
ggplotly(UltraVioletPlotsRCV[[15]])
ggplotly(UltraVioletPlotsRCV[[16]])
ggplotly(VioletPlotsRCV[[1]])
ggplotly(VioletPlotsRCV[[2]])
ggplotly(VioletPlotsRCV[[3]])
ggplotly(VioletPlotsRCV[[4]])
ggplotly(VioletPlotsRCV[[5]])
ggplotly(VioletPlotsRCV[[6]])
ggplotly(VioletPlotsRCV[[7]])
ggplotly(VioletPlotsRCV[[8]])
ggplotly(VioletPlotsRCV[[9]])
ggplotly(VioletPlotsRCV[[10]])
ggplotly(VioletPlotsRCV[[11]])
ggplotly(VioletPlotsRCV[[12]])
ggplotly(VioletPlotsRCV[[13]])
ggplotly(VioletPlotsRCV[[14]])
ggplotly(VioletPlotsRCV[[15]])
ggplotly(VioletPlotsRCV[[16]])
ggplotly(BluePlotsRCV[[1]])
ggplotly(BluePlotsRCV[[2]])
ggplotly(BluePlotsRCV[[3]])
ggplotly(BluePlotsRCV[[4]])
ggplotly(BluePlotsRCV[[5]])
ggplotly(BluePlotsRCV[[6]])
ggplotly(BluePlotsRCV[[7]])
ggplotly(BluePlotsRCV[[8]])
ggplotly(BluePlotsRCV[[9]])
ggplotly(BluePlotsRCV[[10]])
ggplotly(BluePlotsRCV[[11]])
ggplotly(BluePlotsRCV[[12]])
ggplotly(BluePlotsRCV[[13]])
ggplotly(BluePlotsRCV[[14]])
ggplotly(YellowGreenPlotsRCV[[1]])
ggplotly(YellowGreenPlotsRCV[[2]])
ggplotly(YellowGreenPlotsRCV[[3]])
ggplotly(YellowGreenPlotsRCV[[4]])
ggplotly(YellowGreenPlotsRCV[[5]])
ggplotly(YellowGreenPlotsRCV[[6]])
ggplotly(YellowGreenPlotsRCV[[7]])
ggplotly(YellowGreenPlotsRCV[[8]])
ggplotly(YellowGreenPlotsRCV[[9]])
ggplotly(YellowGreenPlotsRCV[[10]])
ggplotly(RedPlotsRCV[[1]])
ggplotly(RedPlotsRCV[[2]])
ggplotly(RedPlotsRCV[[3]])
ggplotly(RedPlotsRCV[[4]])
ggplotly(RedPlotsRCV[[5]])
ggplotly(RedPlotsRCV[[6]])
ggplotly(RedPlotsRCV[[7]])
ggplotly(RedPlotsRCV[[8]])
ggplotly(OtherPlotsRCV[[1]])
ggplotly(OtherPlotsRCV[[2]])
ggplotly(OtherPlotsRCV[[3]])